//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __ELASTOS_KERNEL_MEMORY_INNER_H__
#define __ELASTOS_KERNEL_MEMORY_INNER_H__
#include <core.h>

#if defined(KERNEL_MEMORY_DETECT)

#define KMEM_DETECT_HASH_SIZE 1024
#define KMEM_DETECT_STACK_DEPTH 8

#define ASSERT_MEM_NULL(p) \
    do { \
        if (NULL == p) { \
            kprintf("\nERROR: Out of memory!\n"); \
            DebugBreak(); \
        } \
    } while(0)

class Thread;
typedef struct KMemBlock : public DLinkNode
{
    Address  callStack[KMEM_DETECT_STACK_DEPTH];
    PVoid  pAddr;
    UInt32  uSize;
    Thread  *pThread;
    Boolean bPhysPage;
} KMemBlock, *PKMemBlock;

#endif //KERNEL_MEMORY_DETECT

#endif //__ELASTOS_KERNEL_MEMORY_INNER_H__
